Problems using LLDB to remotely debug a RISCV program running on QEMU

您所在的位置:网站首页 riscv debug Problems using LLDB to remotely debug a RISCV program running on QEMU

Problems using LLDB to remotely debug a RISCV program running on QEMU

#Problems using LLDB to remotely debug a RISCV program running on QEMU| 来源: 网络整理| 查看: 265

The relevant details are as follows:

Starting QEMU:

qemu-system-riscv32 -nographic -smp 1 -gdb tcp::23450 -m 1G -bios ../tests/c_code/test_gdbstub_riscv32 -S

LLDB command and output as follow:

$ lldb -d ../tests/c_code/test_gdbstub_riscv32 (lldb) target create "../tests/c_code/test_gdbstub_riscv32" Current executable set to '../tests/c_code/test_gdbstub_riscv32' (riscv32). (lldb) gdb-remote localhost:23450 (lldb) Process 1 stopped * thread #1, stop reason = signal SIGTRAP frame #0: 0xffffffffffffffff b main Breakpoint 1: where = test_gdbstub_riscv32`main + 8 at test_gdbstub.c:31:15, address = 0x800001a2 (lldb) c Process 1 resuming (lldb) list main File: tests/c_code/test_gdbstub.c 24 static const int cc = 3; 25 26 return actual_calc(ca, cb+cc); 27 } 28 29 int main(void) 30 { 31 const int ma = 13; 32 const int mb = 0; 33 34 result = calc(ma, mb); (lldb) c error: Process is running. Use 'process interrupt' to pause execution. (lldb)

LLDB version:

lldb version 16.0.0git (https://github.com/llvm/llvm-project.git revision fcfa9c7fcdbab22c42ef74d3975ecede5b912f6b) clang revision fcfa9c7fcdbab22c42ef74d3975ecede5b912f6b llvm revision fcfa9c7fcdbab22c42ef74d3975ecede5b912f6b

build QEMU:

mkdir build cd build ../configure --target-list=riscv32-softmmu,riscv32-linux-user make

The command to generate test_gdbstub is:

riscv32-unknown-elf-gcc -gdwarf-4 -Wall -Wextra test_gdbstub.c -o test_gdbstub_riscv32

The version of riscv32-unknown-elf-gcc is:

riscv32-unknown-elf-gcc (g5964b5cd727) 11.1.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Source code for test is:

/* * test_gdbstub.c * * Copyright (c) 2022. All rights reserved. * Date: 2022-09-14 * @author Zhao Shaowei */ static int result; static int actual_calc(int aa, int ab) { int ac; ac = aa / ab; return ac; } static int calc(int ca, int cb) { static const int cc = 3; return actual_calc(ca, cb+cc); } int main(void) { const int ma = 13; const int mb = 0; result = calc(ma, mb); return 0; }


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3